﻿@model CustomerReturnRequestsModel
@using SpotsHub.Gateway.Models.Customer;
@using Nop.Core.Infrastructure;
@using Telerik.Web.Mvc;
@using Telerik.Web.Mvc.UI;
@{
    Layout = "~/Views/Shared/_MyHUB.cshtml";
    ViewBag.Title = T("Account.CustomerReturnRequests");
    //title
    Html.AddTitleParts(T("PageTitle.Account").Text);
    var gridPageSize = EngineContext.Current.Resolve<Nop.Core.Domain.Customers.CustomerSettings>().GridPageSize;
    if (gridPageSize <= 0)
    {
        gridPageSize = 10;
    }
}
@section left
{
    @Html.Partial("MyAccountNavigation", Model.NavigationModel, new ViewDataDictionary())
}

<h1>@T("Account.CustomerReturnRequests")</h1>
<div class="my-hub-body section-wrapper">
    @(Html.Telerik().Grid<CustomerReturnRequestsModel.ReturnRequestModel>()
        .Name("return-requests-list")
        .DataBinding(binding =>
        {
            binding.Ajax()
                .Select("ReturnRequestsList", "Customer", Model.Items);
        })
        .Columns(columns =>
        {
            columns.Bound(x => x.Id).HeaderHtmlAttributes(new { Class = "return-id t-header" }).ClientTemplate("Request# <#= Id #> - <#= ReturnRequestStatus #>").HtmlAttributes(new { Class = "return-id"});
            columns.Bound(x => x.ProductName).HeaderHtmlAttributes(new { Class = "return-product t-header" }).ClientTemplate("<label>Product:</label> <#= ProductName #>");
            columns.Bound(x => x.Quantity).HeaderHtmlAttributes(new { Class = "return-quantity t-header" }).ClientTemplate("<label>Qty:</label> <#= Quantity #>");
            columns.Bound(x => x.CreatedOn).HeaderHtmlAttributes(new { Class = "created-on t-header" }).ClientTemplate("<label>Created:</label> <#= CreatedOn #>");
            columns.Bound(x => x.ReturnAction).HeaderHtmlAttributes(new { Class = "return-action t-header" }).ClientTemplate("<label>Action:</label> <#= ReturnAction #>");
            columns.Bound(x => x.ReturnRequestStatus).HeaderHtmlAttributes(new { Class = "return-status t-header" }).ClientTemplate("<label>Status:</label> <#= ReturnRequestStatus #>");
        })
        .Pageable(settings => settings.PageSize(gridPageSize).Position(GridPagerPosition.Bottom))
        .EnableCustomBinding(true))
    @*
        @foreach (var item in Model.Items)
        {
            <fieldset class="request-item">
                <h3 class="title">@string.Format(T("Account.CustomerReturnRequests.Title").Text, item.Id, item.ReturnRequestStatus)</h3>
                <div class="info">
                    <div class="product">
                        @T("Account.CustomerReturnRequests.Item") <a href="@Url.RouteUrl("Product", new { SeName = item.ProductSeName })" title="View details">@item.ProductName</a>
                        x @item.Quantity
                    </div>
                    <div class="reason">
                        @string.Format(T("Account.CustomerReturnRequests.Reason").Text, item.ReturnReason)
                    </div>
                    <div class="action">
                        @string.Format(T("Account.CustomerReturnRequests.Action").Text, item.ReturnAction)
                    </div>
                    <div class="date">
                        @string.Format(T("Account.CustomerReturnRequests.Date").Text, item.CreatedOn.ToString())
                    </div>
                    @if (!String.IsNullOrEmpty(item.Comments))
                    {
                        <div class="comments-label">
                            @T("Account.CustomerReturnRequests.Comments")
                        </div>
                        <div class="comments">
                            @Html.Raw(Nop.Core.Html.HtmlHelper.FormatText(item.Comments, false, true, false, false, false, false))
                        </div>
                    }
                </div>
            </fieldset>
            <div class="clear">
            </div>
        }
    *@
</div>